import 'package:get/get.dart';
import 'package:yp/services/api.dart';

import 'state.dart';

class DrawBillDetailController extends GetxController {
  bool _isNeedDill = false;
  bool get isNeedDill => _isNeedDill;
  final state = DrawBillDetailState();

  @override
  void onInit() {
    super.onInit();

    if (Get.arguments["tml_num_id"].toString().isNotEmpty) {
      Api.queryInvoiceDetails({"tml_num_id": Get.arguments["tml_num_id"]})
          .listen((event) {
        if (event['code'] == 0) {
          if (event["invoice_info"] != null) {
            state.info = event["invoice_info"];
            update();
          }
        }
      });
    }
  }
}
